package com.luomo.wenyuan.modules.wenyuan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luomo.wenyuan.common.utils.PageUtils;
import com.luomo.wenyuan.common.utils.Query;
import com.luomo.wenyuan.modules.wenyuan.dao.TPurchaseBookDao;
import com.luomo.wenyuan.modules.wenyuan.entity.TPurchaseBookEntity;
import com.luomo.wenyuan.modules.wenyuan.service.TPurchaseBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("tPurchaseBookService")
public class TPurchaseBookServiceImpl extends ServiceImpl<TPurchaseBookDao, TPurchaseBookEntity> implements TPurchaseBookService {

    @Autowired
    private TPurchaseBookDao tPurchaseBookDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TPurchaseBookEntity> page = this.page(
                new Query<TPurchaseBookEntity>().getPage(params),
                new QueryWrapper<TPurchaseBookEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<TPurchaseBookEntity> getByPurchaseId(Integer purchaseId) {
        return tPurchaseBookDao.getByPurchaseId(purchaseId);
    }

}